import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout.ParallelGroup;
import javax.swing.GroupLayout.SequentialGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu.Separator;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.KeyStroke;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SpinnerNumberModel;
import javax.swing.UIManager;
import org.rsbot.script.ScriptManifest;

final class VoluntaryThieve$GraphicalInterface extends JFrame
{
  private boolean shouldStart;
  private JMenuItem aboutMenuItem;
  private JMenu editMenu;
  private JCheckBox enableDebugCheckBox;
  private JMenuItem exitMenuItem;
  private JPopupMenu.Separator exitSeparator;
  private JMenu fileMenu;
  private JLabel generalLabel;
  private JSeparator generalSeparator;
  private JCheckBox getNewGlovesCheckBox;
  private JMenu helpMenu;
  private JMenuBar mainMenuBar;
  private JLabel maxHoursLabel;
  private JSpinner maxHoursSpinner;
  private JLabel maxLevelsLabel;
  private JSpinner maxLevelsSpinner;
  private JLabel maxMinutesLabel;
  private JSpinner maxMinutesSpinner;
  private JLabel maxPickpocketsLabel;
  private JSpinner maxPickpocketsSpinner;
  private JLabel maxSecondsLabel;
  private JSpinner maxSecondsSpinner;
  private JLabel maximumRuntimeLabel;
  private JComboBox modeComboBox;
  private JLabel modeLabel;
  private JLabel otherLabel;
  private JSeparator otherSeparator;
  private JMenuItem resetMenuItem;
  private JMenu runMenu;
  private JButton saveButton;
  private JMenuItem saveMenuItem;
  private JButton startButton;
  private JMenuItem startMenuItem;
  private JLabel stopConditionsLabel;
  private JSeparator stopConditionsSeparator;

  private VoluntaryThieve$GraphicalInterface(VoluntaryThieve paramVoluntaryThieve)
  {
    try
    {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception localException)
    {
    }

    initComponents();
    initSettings();
  }

  private void initComponents()
  {
    this.generalLabel = new JLabel();
    this.generalSeparator = new JSeparator();
    this.modeLabel = new JLabel();
    this.modeComboBox = new JComboBox();
    this.getNewGlovesCheckBox = new JCheckBox();
    this.maxHoursSpinner = new JSpinner();
    this.maximumRuntimeLabel = new JLabel();
    this.stopConditionsSeparator = new JSeparator();
    this.stopConditionsLabel = new JLabel();
    this.maxLevelsLabel = new JLabel();
    this.maxHoursLabel = new JLabel();
    this.maxMinutesSpinner = new JSpinner();
    this.maxPickpocketsLabel = new JLabel();
    this.maxLevelsSpinner = new JSpinner();
    this.maxPickpocketsSpinner = new JSpinner();
    this.maxSecondsLabel = new JLabel();
    this.maxMinutesLabel = new JLabel();
    this.maxSecondsSpinner = new JSpinner();
    this.otherLabel = new JLabel();
    this.otherSeparator = new JSeparator();
    this.enableDebugCheckBox = new JCheckBox();
    this.startButton = new JButton();
    this.saveButton = new JButton();
    this.mainMenuBar = new JMenuBar();
    this.fileMenu = new JMenu();
    this.saveMenuItem = new JMenuItem();
    this.exitSeparator = new JPopupMenu.Separator();
    this.exitMenuItem = new JMenuItem();
    this.editMenu = new JMenu();
    this.resetMenuItem = new JMenuItem();
    this.runMenu = new JMenu();
    this.startMenuItem = new JMenuItem();
    this.helpMenu = new JMenu();
    this.aboutMenuItem = new JMenuItem();

    setDefaultCloseOperation(0);
    setTitle(VoluntaryThieve.access$11000().name() + " v" + VoluntaryThieve.access$11000().version());
    setResizable(false);
    addWindowListener(new VoluntaryThieve.GraphicalInterface.1(this));

    this.generalLabel.setFont(new Font("Tahoma", 1, 11));
    this.generalLabel.setText("General");
    this.generalLabel.setName("generalLabel");

    this.generalSeparator.setName("generalSeparator");

    this.modeLabel.setText("Mode:");
    this.modeLabel.setName("modeLabel");

    this.modeComboBox.setModel(new DefaultComboBoxModel(new String[] { "Blackjack", "Pickpocket" }));
    this.modeComboBox.setName("modeComboBox");
    this.modeComboBox.addItemListener(new VoluntaryThieve.GraphicalInterface.2(this));

    this.getNewGlovesCheckBox.setText("Get new gloves when run out");
    this.getNewGlovesCheckBox.setBorder(null);
    this.getNewGlovesCheckBox.setName("getNewGlovesCheckBox");
    this.getNewGlovesCheckBox.setEnabled(false);

    this.maxHoursSpinner.setModel(new SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
    this.maxHoursSpinner.setName("maxHoursSpinner");

    this.maximumRuntimeLabel.setText("Maximum runtime:");
    this.maximumRuntimeLabel.setName("maximumRuntimeLabel");

    this.stopConditionsSeparator.setName("stopConditionsSeparator");

    this.stopConditionsLabel.setFont(new Font("Tahoma", 1, 11));
    this.stopConditionsLabel.setText("Stop Conditions");
    this.stopConditionsLabel.setName("stopConditionsLabel");

    this.maxLevelsLabel.setText("Maximum levels:");
    this.maxLevelsLabel.setName("maxLevelsLabel");

    this.maxHoursLabel.setText("H:");
    this.maxHoursLabel.setName("maxHoursLabel");

    this.maxMinutesSpinner.setModel(new SpinnerNumberModel(0, 0, 59, 1));
    this.maxMinutesSpinner.setName("maxMinutesSpinner");

    this.maxPickpocketsLabel.setText("Maximum pickpockets:");
    this.maxPickpocketsLabel.setName("maxPickpocketsLabel");

    this.maxLevelsSpinner.setModel(new SpinnerNumberModel(0, 0, 99, 1));
    this.maxLevelsSpinner.setName("maxLevelsSpinner");

    this.maxPickpocketsSpinner.setModel(new SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
    this.maxPickpocketsSpinner.setName("maxPickpocketsSpinner");

    this.maxSecondsLabel.setText("S");
    this.maxSecondsLabel.setName("maxSecondsLabel");

    this.maxMinutesLabel.setText("M:");
    this.maxMinutesLabel.setName("maxMinutesLabel");

    this.maxSecondsSpinner.setModel(new SpinnerNumberModel(0, 0, 59, 1));
    this.maxSecondsSpinner.setName("maxSecondsSpinner");

    this.otherLabel.setFont(new Font("Tahoma", 1, 11));
    this.otherLabel.setText("Other");
    this.otherLabel.setName("otherLabel");

    this.otherSeparator.setName("otherSeparator");

    this.enableDebugCheckBox.setText("Enable debug");
    this.enableDebugCheckBox.setBorder(null);
    this.enableDebugCheckBox.setName("enableDebugCheckBox");

    this.startButton.setText("Start");
    this.startButton.setName("startButton");
    this.startButton.addActionListener(new VoluntaryThieve.GraphicalInterface.3(this));

    this.saveButton.setText("Save");
    this.saveButton.setName("saveButton");
    this.saveButton.addActionListener(new VoluntaryThieve.GraphicalInterface.4(this));

    this.mainMenuBar.setName("mainMenuBar");

    this.fileMenu.setText("File");
    this.fileMenu.setName("fileMenu");
    this.fileMenu.addActionListener(new VoluntaryThieve.GraphicalInterface.5(this));

    this.saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(83, 2));
    this.saveMenuItem.setText("Save");
    this.saveMenuItem.setName("saveMenuItem");
    this.fileMenu.add(this.saveMenuItem);

    this.exitSeparator.setName("exitSeparator");
    this.fileMenu.add(this.exitSeparator);

    this.exitMenuItem.setText("Exit");
    this.exitMenuItem.setName("exitMenuItem");
    this.exitMenuItem.addActionListener(new VoluntaryThieve.GraphicalInterface.6(this));

    this.fileMenu.add(this.exitMenuItem);

    this.mainMenuBar.add(this.fileMenu);

    this.editMenu.setText("Edit");
    this.editMenu.setName("editMenu");

    this.resetMenuItem.setText("Reset Permissions");
    this.resetMenuItem.setName("resetMenuItem");
    this.resetMenuItem.addActionListener(new VoluntaryThieve.GraphicalInterface.7(this));

    this.editMenu.add(this.resetMenuItem);

    this.mainMenuBar.add(this.editMenu);

    this.runMenu.setText("Run");
    this.runMenu.setName("runMenu");

    this.startMenuItem.setAccelerator(KeyStroke.getKeyStroke(83, 10));
    this.startMenuItem.setText("Start");
    this.startMenuItem.setName("startMenuItem");
    this.startMenuItem.addActionListener(new VoluntaryThieve.GraphicalInterface.8(this));

    this.runMenu.add(this.startMenuItem);

    this.mainMenuBar.add(this.runMenu);

    this.helpMenu.setText("Help");
    this.helpMenu.setName("helpMenu");

    this.aboutMenuItem.setText("About");
    this.aboutMenuItem.setName("aboutMenuItem");
    this.aboutMenuItem.addActionListener(new VoluntaryThieve.GraphicalInterface.9(this));

    this.helpMenu.add(this.aboutMenuItem);

    this.mainMenuBar.add(this.helpMenu);

    setJMenuBar(this.mainMenuBar);

    GroupLayout localGroupLayout = new GroupLayout(getContentPane());
    getContentPane().setLayout(localGroupLayout);
    localGroupLayout.setHorizontalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addContainerGap().addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false).addComponent(this.generalSeparator, GroupLayout.Alignment.LEADING).addComponent(this.generalLabel, GroupLayout.Alignment.LEADING, -1, -1, 32767)).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false).addComponent(this.stopConditionsSeparator).addComponent(this.stopConditionsLabel)).addGroup(localGroupLayout.createSequentialGroup().addGap(10, 10, 10).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.getNewGlovesCheckBox).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.modeLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.modeComboBox, -2, -1, -2)))).addGroup(localGroupLayout.createSequentialGroup().addGap(10, 10, 10).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.maxPickpocketsLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxPickpocketsSpinner, -2, 60, -2)).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.maximumRuntimeLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxHoursSpinner, -2, 39, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxHoursLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxMinutesSpinner, -2, 39, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxMinutesLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxSecondsSpinner, -2, 39, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxSecondsLabel)).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.maxLevelsLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.maxLevelsSpinner, -2, 39, -2))))).addContainerGap(-1, 32767)).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addContainerGap(157, 32767).addComponent(this.saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.startButton).addContainerGap()).addGroup(localGroupLayout.createSequentialGroup().addContainerGap().addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(this.enableDebugCheckBox)).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false).addComponent(this.otherSeparator).addComponent(this.otherLabel))).addContainerGap(184, 32767)));

    localGroupLayout.setVerticalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addContainerGap().addComponent(this.generalLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.generalSeparator, -2, 1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(this.modeLabel).addComponent(this.modeComboBox, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.getNewGlovesCheckBox).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.stopConditionsLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.stopConditionsSeparator, -2, 1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(this.maximumRuntimeLabel).addComponent(this.maxHoursSpinner, -2, -1, -2).addComponent(this.maxHoursLabel).addComponent(this.maxMinutesSpinner, -2, -1, -2).addComponent(this.maxMinutesLabel).addComponent(this.maxSecondsSpinner, -2, -1, -2).addComponent(this.maxSecondsLabel)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(this.maxPickpocketsLabel).addComponent(this.maxPickpocketsSpinner, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(this.maxLevelsLabel).addComponent(this.maxLevelsSpinner, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.otherLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.otherSeparator, -2, 1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.enableDebugCheckBox).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, -1, 32767).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(this.startButton).addComponent(this.saveButton)).addContainerGap()));

    pack();
  }

  private void initSettings()
  {
    Component[] arrayOfComponent1 = getContentPane().getComponents();
    for (Map.Entry localEntry : getOptions().entrySet()) {
      String str = VoluntaryThieve.Configuration.access$11900(VoluntaryThieve.access$11800(this.this$0), (String)localEntry.getKey(), null);

      if (str != null)
        for (Component localComponent : arrayOfComponent1)
          if (((String)localEntry.getKey()).equals(localComponent.getName())) {
            if ((localComponent instanceof JComboBox)) {
              ((JComboBox)localComponent).setSelectedItem(str); break;
            }if ((localComponent instanceof JSpinner))
              try {
                ((JSpinner)localComponent).setValue(Integer.valueOf(Integer.parseInt(str)));
              } catch (NumberFormatException localNumberFormatException) {
              }
            if ((localComponent instanceof JCheckBox)) {
              ((JCheckBox)localComponent).setSelected(Boolean.valueOf(str).booleanValue()); break;
            }throw new AssertionError((String)localEntry.getKey() + ": " + str);
          }
    }
  }

  private Map<String, String> getOptions()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put(this.modeComboBox.getName(), this.modeComboBox.getSelectedItem().toString());
    localHashMap.put(this.getNewGlovesCheckBox.getName(), String.valueOf(this.getNewGlovesCheckBox.isSelected()));
    localHashMap.put(this.maxHoursSpinner.getName(), this.maxHoursSpinner.getValue().toString());
    localHashMap.put(this.maxMinutesSpinner.getName(), this.maxMinutesSpinner.getValue().toString());
    localHashMap.put(this.maxSecondsSpinner.getName(), this.maxSecondsSpinner.getValue().toString());
    localHashMap.put(this.maxPickpocketsSpinner.getName(), this.maxPickpocketsSpinner.getValue().toString());
    localHashMap.put(this.maxLevelsSpinner.getName(), this.maxLevelsSpinner.getValue().toString());
    localHashMap.put(this.enableDebugCheckBox.getName(), String.valueOf(this.enableDebugCheckBox.isSelected()));
    return localHashMap;
  }

  private boolean shouldStart()
    throws IllegalStateException
  {
    if (isVisible()) throw new IllegalStateException();
    return this.shouldStart;
  }

  private void saveActionPerformed(ActionEvent paramActionEvent)
  {
    for (Map.Entry localEntry : getOptions().entrySet())
      VoluntaryThieve.Configuration.access$12000(VoluntaryThieve.access$11800(this.this$0), (String)localEntry.getKey(), (String)localEntry.getValue());
  }

  private void startActionPerformed(ActionEvent paramActionEvent)
  {
    this.shouldStart = true;
    exitActionPerformed(paramActionEvent);
  }

  private void aboutMenuItemActionPerformed(ActionEvent paramActionEvent)
  {
    JOptionPane.showMessageDialog(this, VoluntaryThieve.access$11000().name() + " v" + VoluntaryThieve.access$11000().version() + " by vilon.\n" + "Visit http://www.powerbot.org/" + " for more information.", "About", 1);
  }

  private void resetMenuItemActionPerformed(ActionEvent paramActionEvent)
  {
    VoluntaryThieve.Configuration.access$12100(VoluntaryThieve.access$11800(this.this$0));
  }

  private void exitActionPerformed(ActionEvent paramActionEvent)
  {
    setVisible(false);
    dispose();
  }
}